<?php
/**
 * Created by PhpStorm.
 * User: kirito
 * Date: 2019/5/17
 * Time: 下午2:25
 */

include "include.php";

die('is over done');
$config = array(
    'appid' => 'wx4ba5a0e1070e48aa',
    'appsecret' => 'b627d78539abda6da172c767a1182dae'
);
$wx = new \Wechat\WechatCard($config);
$type = isset($_GET['type']) ? $_GET['type'] : '99';

## 开通礼品卡权限
$data1 = array(
    "sub_mch_id" => "1524756891"
);

## 绑定商户号到礼品卡小程序
### 小程序原始id与app_id区分一下
$data2 = array(
    "sub_mch_id" => "1524756891",
    "wxa_appid" => "wx0208c3dfc589858f"
);

## 上传礼品卡小程序代码
$data3 = array(
    "wxa_appid" => "wx0208c3dfc589858f",
    "page_id" => "Zc6Ii37Q/RfJh9ExJtCrEwmGxP3ckr0CM9Ff7dfW8U4="
);

$res = '';
switch ($type){
    case 1:
        $res = $wx->addWhiteList($data1);
        break;
    case 2:
        $res = $wx->bindSubmch($data2);
        break;
    case 3:
        $res = $wx->wxaSet($data3);
        break;
    default:
        $res = 'no choose!';
        break;
}

var_dump($res);die;